Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

fixturify

Package Overview
Dependencies
Maintainers
2
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fixturify

Convert objects into directory structures and back again

  • 2.1.1
  • Source
  • npm
  • Socket score

Version published
Maintainers
2
Created

What is fixturify?

Fixturify is an npm package that allows you to create and manipulate file system fixtures programmatically. It is particularly useful for testing purposes, where you need to set up a specific file system state before running tests.

What are fixturify's main functionalities?

Create File System Fixtures

This feature allows you to create a directory structure with files and content programmatically. The `writeSync` method writes the specified files and directories to the file system.

const fixturify = require('fixturify');

const files = {
  'index.js': 'console.log("Hello, world!");',
  'lib': {
    'module.js': 'module.exports = {};'
  }
};

fixturify.writeSync('my-fixture', files);

Read File System Fixtures

This feature allows you to read a directory structure and its contents into a JavaScript object. The `readSync` method reads the specified directory and returns an object representing the file system structure.

const fixturify = require('fixturify');

const files = fixturify.readSync('my-fixture');
console.log(files);

Update File System Fixtures

This feature allows you to update an existing directory structure with new files or changes to existing files. The `writeSync` method can be used to overwrite or add new files to the specified directory.

const fixturify = require('fixturify');

const updates = {
  'index.js': 'console.log("Updated content");',
  'lib': {
    'newModule.js': 'module.exports = { new: true };'
  }
};

fixturify.writeSync('my-fixture', updates);

Other packages similar to fixturify

FAQs

Package last updated on 19 Apr 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc